#ifndef _HEDMODEL	
#define _HEDMODEL

#include <vector>
#include "point.h"
using namespace std;
class Solid;
class Face;
class HalfEdge;
class Vertex;
class Edge;




class HEDModel
{

public:

	HEDModel();

	Solid* getFirsts();
	void setFirsts( Solid* _firsts);
	Solid* getsolid(int sn);
	Face* fface(Solid* s, int fn);
	HalfEdge* fhe(Face* f, int vn1, int vn2);
  Vertex* getVertex(int vn);

  Vertex* getVertex(double _x, double _y, double _z, double _tol);
  Edge* getEdge(double _x, double _y, double _z, double _tol);
  Face* getFace(double _x, double _y, double _z, double _tol );

  int getNumberOfVertexes();
  vector<Vertex*> getVertexes();
  vector<Edge*> getEdges();
  int getNumberOfFaces();
  vector<Face*> getFaces();

	void getEdgeVertexes();
	void replaceVertex();
	void getCurve();

  HalfEdge* getHalfEdge( Vertex* _v, double _x, double _y, double _z );
  HalfEdge* getHalfEdgeNEW( Vertex* _v, double _x, double _y, double _z );

  // testing tessellation
  void triagulate(vector<Point*>& p, vector<vector<int> >& t);
  bool ear_Q(int i, int j, int k, vector<Point*>& p);
  bool point_in_triangle(Point* p, vector<Point*>& t);
  bool cw(Point* a, Point* b, Point* c);
  double signed_triangle_area(Point* a, Point* b, Point* c);


private:

	Solid* firsts;

};

#endif
